package com.huawei;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Scanner;

public class HJ036 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String key = scanner.nextLine();
        String rawValue = scanner.nextLine();

        char[] dictionaryArr = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

        char[] charArray = key.toCharArray();
        LinkedHashSet<Character> characterLinkedHashSet = new LinkedHashSet<Character>();
        for (int i = 0; i < charArray.length; i++) {
            char c = charArray[i];
            characterLinkedHashSet.add(c);
        }
        for (int i = 0; i < dictionaryArr.length; i++) {
            characterLinkedHashSet.add(dictionaryArr[i]);
        }

        Character[] encryptArr = characterLinkedHashSet.toArray(new Character[characterLinkedHashSet.size()]);
        // 数组方便使用索引：a-97
        StringBuilder resultValue = new StringBuilder();
        for (int i = 0; i < rawValue.length(); i++) {
            int index = rawValue.charAt(i) - 97;
            resultValue.append(encryptArr[index]);
        }
        System.out.println(resultValue);

    }


}
